<template>
  <div>

    <el-bread></el-bread>

    <el-button
      type="primary"
      size="mini"
      plain
      style="margin-top: 10px"
      @click="addDialog"
      >添加</el-button
    >
    <!-- 表格 -->
    <v-list @edit="edit"></v-list>
    <!-- 弹框 -->
    <v-dialog ref="dialogRef" :diaInfo="diaInfo" @cancel="cancel" />
  </div>
</template>
<script>
// 引入组件
import vList from "./list";
import vDialog from "./dialog";
export default {
  data() {
    return {
      diaInfo:{
        isShow:false, // 是否打开弹框
        isAdd:true, // 是添加还是编辑 
      }
    };
  },
  methods: {
    addDialog() {
        // 告诉显示框 isShow需要显示出来
        this.diaInfo.isShow = true
        // 控制是添加还是编辑
        this.diaInfo.isAdd = true
    },
    // 关闭弹窗
    cancel(e){
        this.diaInfo.isShow = e
    },
    // 编辑打开弹框
    edit(e){
        this.diaInfo.isShow = true;
      // 告诉你弹框是一个编辑

        this.diaInfo.isAdd = false;
        this.$refs.dialogRef.lookup(e)
    }
  },
  mounted() {},
  watch: {},
  computed: {},
  filters: {},
  components: {
    vList,
    vDialog,
  },
};
</script>
<style scoped></style>
